<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>selection</title>
    <script src="./d3.js"></script>
    <link rel="stylesheet" href="./main.css">
    <style type="text/css">
        #demo {
            height: 500px;
            width: 500px;
        }

    </style>
</head>

<body>
    <div></div>
    <div></div>
    <div></div>

    <section id="demo"></section>
    <script type="text/javascript">
        var selector = document.querySelectorAll("div");
        selector.forEach(function (e) {
            // do something with each element selected
            console.log(String(e));
        });
        d3.selectAll("div") // <-- A
            .attr("class", "red box"); // <-- B
        d3.selectAll("div") // <-- A
            .attr("class", "red box") // <-- B
            .each(function (d, i) { // <-- C
                d3.select(this).append("h1").text(i); // <-- D
            });
        d3.select("body")
            .style("margin", "10px auto")
            .style("overflow", "hidden")
            .selectAll("div")
            .style("background-color", "#bbb");
        d3.selectAll("div").nodes();


    </script>
</body>

</html>
